package cj.web.admin.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cj.web.admin.dao.CategoryDAO;
import cj.web.admin.domain.Category;


@Service
public class CategoryService {

	@Autowired
    private CategoryDAO categoryDAO;
	
	public List<Category> queryAll(){
		return categoryDAO.queryAll();
	}
	
	/**
	 * 查询
	 * @param category
	 * @return categorylis;size
	 */
	public Map query(Category category){
		Map rep = new HashMap();
		List<Category> categorylis = categoryDAO.query(category);
		int size = categoryDAO.querySize(category); 
		rep.put("categorylis", categorylis);
		rep.put("size", size);
		return rep;
    }
	
	public Category queryById(int id){
		Category obj = categoryDAO.queryById(id);
		return obj;
    }
	
	public void create(Category category){
		categoryDAO.create(category);
	}
	
	public void update(Category category){
		categoryDAO.update(category);
	}
	
	public void deleteById(int id){
		categoryDAO.deleteById(id);
	}
}
